﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WebDomain.Entities;

namespace WebDomain.Concrete
{
    public class EFCustomPCRepository
    {
        private CZTopComputersEntities context = new CZTopComputersEntities();

        public IQueryable<Entities.CustomPC> CustomPCs
        {
            get { return context.CustomPCs; }
        }

        public void RemoveCustomPC(CustomPC pc)
        {
            context.CustomPCs.DeleteObject(pc);
            context.SaveChanges();
        }

        public void SaveCustomPC(CustomPC pc)
        {
            context.CustomPCs.AddObject(pc);
            context.SaveChanges();
        }

        public int GetPC()
        {
            return context.CustomPCs.Max(p => p.ID);
        }
    }
}
